<?php
class PublicUserAddressForm extends BasePublicUserAddressesForm
{

   public function configure()
   {

		$this->setNameFormat();
		$this->useFields(array('name', 'address', 'phone', 'city', 'country', 'state', 'zip', 'type' ));

		$this->widgetSchema['type'] = new sfWidgetFormInputHidden();

		$this->validatorSchema['name'] =  new sfValidatorString(array('required' => true), array('required' => 'Name required'));
		$this->validatorSchema['address'] =  new sfValidatorString(array('required' => true), array('required' => 'Address required'));
		$this->validatorSchema['phone'] =  new sfValidatorString(array('required' => true),array('required' => 'Phone required') );
		$this->validatorSchema['city'] =  new sfValidatorString(array('required' => true),array('required' => 'City required') );
		$this->validatorSchema['country'] =  new sfValidatorString(array('required' => true),array('required' => 'Country required') );
		$this->validatorSchema['state'] =  new sfValidatorString(array('required' => true),array('required' => 'Region required') );
		$this->validatorSchema['zip'] =  new sfValidatorString(array('required' => true),array('required' => 'Postcode required') );

   }

   
   public function setNameFormat(){
   		$this->widgetSchema->setNameFormat($this->getObject()->getType() . '_address[%s]');
   }
}